import { DataTypes } from "sequelize";
import sequelize from "../db/seq.js";

const User = sequelize.define("User", {
  // id: {
  //   type: DataTypes.INTEGER,
  //   primaryKey: true,
  //   autoIncrement: true,  // id sequelize 自动创建
  // },
  userName: {
    type: DataTypes.STRING,
    allowNull: false,
    unique: true,
    comment: "用户名",
  },
  passWord: {
    type: DataTypes.CHAR(64),
    allowNull: false,
    comment: "密码",
  },
  isAdmin: {
    type: DataTypes.BOOLEAN,
    allowNull: false,
    defaultValue: false,
    comment: "是否是管理员",
  },
});
// User.sync({ force: false }); //console.log("用户模型表刚刚(重新)创建！"); 如果数据库没有表就会创建,如果有会被删除重新创建
export default User;
